package stu.day25_day32.day32.tmp;

import java.util.*;
import java.util.function.Consumer;

public class hw3 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int q = scanner.nextInt();

        List<List<Integer>> neighborDic = new ArrayList<>();
        for (int i = 0; i <= n; i++) {
            neighborDic.add(new ArrayList<>());
        }

        List<Integer> parentList = new ArrayList<>();
        List<Integer> childrenList = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            parentList.add(scanner.nextInt());
        }
        for (int i = 0; i < m; i++) {
            childrenList.add(scanner.nextInt());
        }

        for (int i = 0; i < m; i++) {
            neighborDic.get(parentList.get(i)).add(childrenList.get(i));
        }

        Map<Integer, Integer> leafNumDic = new HashMap<>();

        Consumer<Integer> dfs = new Consumer<Integer>() {
            @Override
            public void accept(Integer node) {
                if (neighborDic.get(node).isEmpty()) {
                    leafNumDic.put(node, 1);
                    return;
                }
                int leafNum = 0;
                for (Integer childNode : neighborDic.get(node)) {
                    accept(childNode);
                    leafNum += leafNumDic.get(childNode);
                }
                leafNumDic.put(node, leafNum);
            }
        };

        dfs.accept(1);

        List<Integer> qList = new ArrayList<>();
        for (int i = 0; i < q; i++) {
            qList.add(scanner.nextInt());
        }

        List<Integer> ans = new ArrayList<>();
        for (Integer node : qList) {
            ans.add(leafNumDic.get(node));
        }

        System.out.println(String.join(" ", ans.stream().map(String::valueOf).toArray(String[]::new)));
    }


}
